package day23;

import java.util.Scanner;

/**
 * @author tongchen
 * @create 2023-03-31 10:36
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        String s1=scanner.nextLine();
        String s2=scanner.nextLine();
        System.out.println(findSub(s1, s2));

    }
    public static int findSub(String s1,String s2){
        String min=s1.length()<s2.length()?s1:s2;
        String max=s1.length()>s2.length()?s1:s2;
        int maxSize=0;
        int sub=0;
        while(sub<min.length()){
            int compare=sub;
            for(int i=0;i+sub<min.length();++i){
                if(max.indexOf(min.substring(i, i+sub+1))!=-1){
                    maxSize=sub+1;
                    sub++;
                    break;
                }
            }
            //校验下次比较是否还有必要
            if(sub==compare){
                break;
            }
        }
        return (min.length()-sub)+(max.length()-min.length());
    }
}
